<template>
    <div>
        <div id="container">

            <div id="header" >
            </div>

        </div>
        <div id="container">
            <div id="content2">
                <table width="100%" height="41" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="15" height="18" align="left" valign="top">
                            <div align="left"></div>
                        </td>
                        <td width="385" align="left" valign="bottom" class="12">&nbsp;</td>
                    </tr>
                    <tr>
                        <td height="4" colspan="2" align="left" valign="bottom"></td>
                    </tr>
                    <tr>
                        <td height="15" align="left" valign="top">&nbsp;</td>
                        <td height="15" align="left" valign="top" class="12">
                            <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td height="20">
                                        <div class="right_proaducts">我的位置&gt;&gt;科技项目申报&gt;管理项目分类列表<br />
                                            <br />
                                        </div>
                                     
                                                    <el-table :data="users" :row-class-name="tableRowClassName">
                                                        <el-table-column label="编号id"
                                                            prop="categoryid"></el-table-column>
                                                        <el-table-column label="分类名称"
                                                            prop="categoryname"></el-table-column>
                                                        <el-table-column label="开始申报时间"
                                                            prop="rep_start_time"></el-table-column>
                                                        <el-table-column label="申报结束时间"
                                                            prop="rep_stop_time"></el-table-column>
                                                        <el-table-column label="操作">
                                                            <template slot-scope="scope">
                                                                <el-row>
                                                                    <el-button type="danger" 
                                                                        @click="project(scope.row)">项目</el-button>
                                                                </el-row>
                                                            </template>
                                                        </el-table-column>
                                                    </el-table>


                                                    <!--展示-->

                                                    <el-dialog title="更新品牌" :visible.sync="updateVisible" width="30%">
                                                        <el-form ref="form" :model="update" label-width="80px">

                                                            <el-form-item label="项目名称">
                                                                <el-input v-model="update.projectname"></el-input>
                                                            </el-form-item>

                                                            <el-form-item label="申请单位">
                                                                <el-input v-model="update.unitname"></el-input>
                                                            </el-form-item>

                                                            <el-form-item label="申请人">
                                                                <el-input v-model="update.applicant"></el-input>
                                                            </el-form-item>

                                                            <el-form-item label="职称">
                                                                <el-input v-model="update.grade"></el-input>
                                                            </el-form-item>

                                                            <el-form-item label="学历">
                                                                <el-input v-model="update.education"></el-input>
                                                            </el-form-item>

                                                            <el-form-item label="填报时间">
                                                                <el-input v-model="update.fill_date"></el-input>
                                                            </el-form-item>

                                                            <el-form-item label="项目现状">
                                                                <el-input v-model="update.status"></el-input>
                                                            </el-form-item>

                                                            <el-form-item label="项目前景">
                                                                <el-input v-model="update.future"></el-input>
                                                            </el-form-item>

                                                            <el-form-item label="重难点分析">
                                                                <el-input v-model="update.analysis"></el-input>
                                                            </el-form-item>
                                                            <el-form-item label="研究方法">
                                                                <el-input v-model="update.way"></el-input>
                                                            </el-form-item>
                                                            <el-form-item label="预计研究成果">
                                                                <el-input v-model="update.result"></el-input>
                                                            </el-form-item>
                                                            <el-form-item label="申请资金">
                                                                <el-input v-model="update.capital"></el-input>
                                                            </el-form-item>
                                                            <el-form-item label="专家评审意见">
                                                                <el-input type="textarea"
                                                                    v-model="update.expert_opinion"></el-input>
                                                            </el-form-item>
                                                            <el-form-item label="专家评分">
                                                                <el-input v-model="update.score"></el-input>
                                                            </el-form-item>
                                                            <el-form-item>
                                                                <el-button type="primary"
                                                                    @click="updateProject()">提交</el-button>
                                                            </el-form-item>
                                                        </el-form>
                                                    </el-dialog>
                                                    <div></div>
                                       
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <div class="table_wz"></div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</template>

<script>

import axios from '../../utils/Myaxios'

const options = {
    data() {
        return {
            updateVisible: false,
            users: [],

            update:{
                    projectname:'',
                    unitname:'',
                    applicant:'',
                    grade:'',
                    education:'',
                    fill_date:'',
                    status:'',
                    future:'',
                    analysis:'',
                    way:'',
                    result:'',
                    capital:'',
                    expert_opinion:'',
                    score:''
            }
        }
    },
    mounted() {
        this.get();
    },
    methods: {
        async get() {
            const _axios = axios.create({
                baseURL: 'http://localhost:8080',
                withCredentials: true
            })
            const resp = await _axios.get('/projectcategorys/selectFour')

            this.users = resp.data.data
        },
        // 查询
        async project(row){
            let rowId = row.id;
            const _axios = axios.create({
                baseURL: 'http://localhost:8080',
                withCredentials: true
            })
            const resp = await _axios.get('/projectcategorys/selectById',{
                params: {
                    categoryid : rowId
                }
            })
            this.update = resp.data.data

            
        },
        async updateProject(){
            const _axios = axios.create({
                baseURL: 'http://localhost:8080',
                withCredentials: true
            })
            await _axios.post('/projectcategorys/',{},{
                params:{
                    projectCategory : this.update
                }
            })
        }
    }
}

export default options
</script>

<style>

</style>